package com.xinchuang.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xinchuang.comment.R;
import com.xinchuang.service.MoldTypeModService;
import com.xinchuang.utils.CheckUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * MoldTypeModController
 *
 * @date 2023-10-17
 */
@RestController
@RequestMapping("/moldTypeMod")
@Api(value = "模具类型管理模块", tags = "模具类型管理模块")
public class MoldTypeModController {
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Resource
    private MoldTypeModService moldTypeModService;

    /**
     * 获取模具类型列表接口  函数名称getMoldTypeList  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/getMoldTypeList")
    @ApiOperation("获取模具类型列表")
    public R getMoldTypeList(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
        result = result + getMoldTypeListACS(sSet);
        if (result.length() > 0) {
            return R.fail("入参：" + result);
        } else {
            // 调用业务层代码
            String r = moldTypeModService.getMoldTypeList(jsonObject);
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject(r);
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
            result = result + getMoldTypeListACB(aSet);
            if (result.length() > 0) {
                return R.fail("出参：" + result);
            }
            return JSON.parseObject(r, R.class);
        }
    }

    /**
     * 保存模具类型接口  函数名称saveMoldType  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/saveMoldType")
    @ApiOperation("保存模具类型")
    public R saveMoldType(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
        result = result + saveMoldTypeACS(sSet);
        if (result.length() > 0) {
            return R.fail("入参：" + result);
        } else {
            // 调用业务层代码
            String r = moldTypeModService.saveMoldType(jsonObject, request);
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject(r);
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
            result = result + saveMoldTypeACB(aSet);
            if (result.length() > 0) {
                return R.fail("出参：" + result);
            }
            return JSON.parseObject(r, R.class);
        }
    }

    /**
     * 删除模具类型接口  函数名称deleteMoldType  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/deleteMoldType")
    @ApiOperation("删除模具类型")
    public R deleteMoldType(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
        result = result + deleteMoldTypeACS(sSet);
        if (result.length() > 0) {
            return R.fail("入参：" + result);
        } else {
            // 调用业务层代码
            String r = moldTypeModService.deleteMoldType(jsonObject);
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject(r);
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
            result = result + deleteMoldTypeACB(aSet);
            if (result.length() > 0) {
                return R.fail("出参：" + result);
            }
            return JSON.parseObject(r, R.class);
        }
    }

    /**
     * 根据模具类型Id获取零件长宽高接口接口  函数名称getPartListByTypeId  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/getPartListByTypeId")
    @ApiOperation("根据模具类型Id获取零件长宽高接口")
    public R getPartListByTypeId(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
        result = result + getPartListByTypeIdACS(sSet);
        if (result.length() > 0) {
            return R.fail("入参：" + result);
        } else {
            // 调用业务层代码
            String r = moldTypeModService.getPartListByTypeId(jsonObject);
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject(r);
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
            result = result + getPartListByTypeIdACB(aSet);
            if (result.length() > 0) {
                return R.fail("出参：" + result);
            }
            return JSON.parseObject(r, R.class);
        }
    }

    /**
     * 删除模具类型中的零件接口  函数名称deleteMoldTypePart  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/deleteMoldTypePart")
    @ApiOperation("删除模具类型中的零件")
    public R deleteMoldTypePart(@RequestBody JSONObject jsonObject) {
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        Set<String> sSet = new HashSet<>();
        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
        result = result + deleteMoldTypePartACS(sSet);
        if (result.length() > 0) {
            return R.fail("入参：" + result);
        } else {
            // 调用业务层代码
            String r = moldTypeModService.deleteMoldTypePart(jsonObject);
            Set<String> aSet = new HashSet<>();
            JSONObject o = JSON.parseObject(r);
            if (o == null) {
                o = new JSONObject();
            }
            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
            result = result + deleteMoldTypePartACB(aSet);
            if (result.length() > 0) {
                return R.fail("出参：" + result);
            }
            return JSON.parseObject(r, R.class);
        }
    }


    public static String jsonLoop(Object object, String result, String methodName, Set<String> set) {
        Object v = null;
        if (object instanceof JSONArray || object instanceof ArrayList) {
            JSONArray jsonArray = new JSONArray();
            if (object instanceof ArrayList) {
                jsonArray = JSONArray.parseArray(JSON.toJSONString(object));
            } else {
                jsonArray = (JSONArray) object;
            }
            for (int i = 0; i < jsonArray.size(); i++) {
                result = jsonLoop(jsonArray.get(i), result, methodName, set);
                if (StringUtils.isNotEmpty(result)) {
                    return result;
                }
            }
        }
        if (object instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject) object;
            for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
                Object o = entry.getValue();
                if (o instanceof JSONArray || o instanceof ArrayList) {
                    result += selectCheckMathod(entry.getKey(), entry.getValue(), methodName, set);
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else if (o instanceof JSONObject) {
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else {
//                   FIXME: 未知类型
                }
                v = entry.getValue();
                result += selectCheckMathod(entry.getKey(), v, methodName, set);
            }
        }
        return result;
    }

    private static String selectCheckMathod(String key, Object value, String methodName, Set<String> set) {
        String result = "";
        if ("getMoldTypeListSC".equals(methodName)) {
            result = getMoldTypeListSC(key, value, set);
        }
        if ("getMoldTypeListAC".equals(methodName)) {
            result = getMoldTypeListAC(key, value, set);
        }
        if ("saveMoldTypeSC".equals(methodName)) {
            result = saveMoldTypeSC(key, value, set);
        }
        if ("saveMoldTypeAC".equals(methodName)) {
            result = saveMoldTypeAC(key, value, set);
        }
        if ("deleteMoldTypeSC".equals(methodName)) {
            result = deleteMoldTypeSC(key, value, set);
        }
        if ("deleteMoldTypeAC".equals(methodName)) {
            result = deleteMoldTypeAC(key, value, set);
        }
        if ("getPartListByTypeIdSC".equals(methodName)) {
            result = getPartListByTypeIdSC(key, value, set);
        }
        if ("getPartListByTypeIdAC".equals(methodName)) {
            result = getPartListByTypeIdAC(key, value, set);
        }
        if ("deleteMoldTypePartSC".equals(methodName)) {
            result = deleteMoldTypePartSC(key, value, set);
        }
        if ("deleteMoldTypePartAC".equals(methodName)) {
            result = deleteMoldTypePartAC(key, value, set);
        }
        return result;
    }


    private static String getMoldTypeListSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("pageNum".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "页码", isNull, "0", "999999");
        }
        if ("moldTypeId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型Id", isNull, 0, 999999999);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldTypeListAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("isStandardCom".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("isMainMaterial".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("totalNum".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "总条数", isNull, "0", "999900");
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "列表数据", isNull);
        }
        if ("moldTypeId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型Id", isNull, 0, 999999999);
        }
        if ("moldTypeName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型名称", isNull, 0, 255);
        }
        if ("createTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "创建时间", isNull, 0, 255);
        }
        if ("createBy".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "创建人", isNull, 0, 255);
        }
        if ("partList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "零件列表", isNull);
        }
        if ("partId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件Id", isNull, 0, 999999999);
        }
        if ("partName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件名称", isNull, 0, 255);
        }
        if ("isMoldFrame".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("density".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "密度", isNull, "0", "99999999");
        }
        if ("constOfLength".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "长度增加常数", isNull, "0", "999999999");
        }
        if ("constOfWidth".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "宽增加常数", isNull, "0", "999999999");
        }
        if ("constOfHeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "高增加常数", isNull, "0", "999999999");
        }
        if ("price".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "单价", isNull, "0", "999999");
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param3".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数3", isNull, 0, 255);
        }
        if ("param4".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数4", isNull, 0, 255);
        }
        if ("param5".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数5", isNull, 0, 255);
        }
        if ("param6".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数6", isNull, 0, 255);
        }
        if ("param7".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数7", isNull, 0, 255);
        }
        if ("param8".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数8", isNull, 0, 255);
        }
        if ("isRequired".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param3".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数3", isNull, 0, 255);
        }
        if ("param4".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数4", isNull, 0, 255);
        }
        if ("param5".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数5", isNull, 0, 255);
        }
        if ("param6".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数6", isNull, 0, 255);
        }
        if ("param7".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数7", isNull, 0, 255);
        }
        if ("param8".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数8", isNull, 0, 255);
        }
        if ("param9".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数9", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String saveMoldTypeSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("isStandardCom".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
        }
        if ("isMainMaterial".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
        }
        if ("partId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件Id", isNull, 0, 999999999);
        }
        if ("moldTypeName".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型名称", isNull, 0, 255);
        }
        if ("moldTypeId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型Id", isNull, 0, 255);
        }
        if ("partList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "零件列表", isNull);
        }
        if ("partName".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件名称", isNull, 0, 255);
        }
        if ("id".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表Id", isNull, 0, 999999999);
        }
        if ("isMoldFrame".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
        }
        if ("density".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "密度", isNull, "0", "999999999");
        }
        if ("constOfLength".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "长度增加常数", isNull, "0", "999999999");
        }
        if ("constOfWidth".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "宽度增加常数", isNull, "0", "999999999");
        }
        if ("constOfHeight".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "高度增加常数", isNull, "0", "999999999");
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param3".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数3", isNull, 0, 255);
        }
        if ("param4".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数4", isNull, 0, 255);
        }
        if ("param5".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数5", isNull, 0, 255);
        }
        if ("param6".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数6", isNull, 0, 255);
        }
        if ("param7".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数7", isNull, 0, 255);
        }
        if ("param8".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数8", isNull, 0, 255);
        }
        if ("isRequired".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param3".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数3", isNull, 0, 255);
        }
        if ("param4".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数4", isNull, 0, 255);
        }
        if ("param5".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数5", isNull, 0, 255);
        }
        if ("param6".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数6", isNull, 0, 255);
        }
        if ("param7".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数7", isNull, 0, 255);
        }
        if ("param8".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数8", isNull, 0, 255);
        }
        if ("param9".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数9", isNull, 0, 255);
        }
        if ("price".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "单价", isNull, "0", "999999999");
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String saveMoldTypeAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldTypeSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("idList".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "ID列表", isNull, 1000, 2, 1, 0, 999999999);

        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldTypeAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getPartListByTypeIdSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("height".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-高", isNull, "0", "99999999");
        }
        if ("width".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-宽", isNull, "0", "99999999");
        }
        if ("length".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-长", isNull, "0", "99999999");
        }
        if ("moldTypeId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型Id", isNull, 0, 99999999);
        }
        if ("moldId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 99999999);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getPartListByTypeIdAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("height".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "计算后高度", isNull, "0", "99999999");
        }
        if ("width".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "计算后宽度", isNull, "0", "99999999");
        }
        if ("length".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "计算后长度", isNull, "0", "99999999");
        }
        if ("density".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "密度", isNull, "0", "99999999");
        }
        if ("isMoldFrame".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("partId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件Id", isNull, 0, 99999999);
        }
        if ("partName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件名称", isNull, 0, 255);
        }
        if ("partsList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "零件列表", isNull);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param3".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数3", isNull, 0, 255);
        }
        if ("param4".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数4", isNull, 0, 255);
        }
        if ("param5".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数5", isNull, 0, 255);
        }
        if ("param6".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数6", isNull, 0, 255);
        }
        if ("param7".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数7", isNull, 0, 255);
        }
        if ("isStandardCom".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("isMainMaterial".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("isRequired".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("price".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "单价", isNull, "0", "999999999");
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldTypePartSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("partId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件Id", isNull, 0, 255);
        }
        if ("moldTypeId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具类型Id", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldTypePartAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldTypeListACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("pageNum");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String getMoldTypeListACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String saveMoldTypeACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("isMoldFrame");
        list.add("isRequired");
        list.add("constOfLength");
        list.add("isMainMaterial");
        list.add("moldTypeName");
        list.add("density");
        list.add("price");
        list.add("isStandardCom");
        list.add("constOfWidth");
        list.add("constOfHeight");
        list.add("partName");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String saveMoldTypeACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String deleteMoldTypeACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("idList");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String deleteMoldTypeACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String getPartListByTypeIdACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("width");
        list.add("length");
        list.add("moldId");
        list.add("moldTypeId");
        list.add("height");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String getPartListByTypeIdACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("price");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String deleteMoldTypePartACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("partId");
        list.add("moldTypeId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String deleteMoldTypePartACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    /**
     * 获取集合中的不同值
     *
     * @param list
     * @param set
     * @return
     */
    private static String getCollectionDifferentValue(List<String> list, Set<String> set, String flag) {
        String result = "";
        for (String str : list) {
            if (!set.contains(str)) {
                result += str + ",";
            }
        }
        if (StringUtils.isNotEmpty(result)) {
            result = StringUtils.strip(result, ",");
            result = "---" + flag + ":" + result + "为必填参数";
        }
        return result;
    }
}
